void splitreal(double x, int* intpart, double* fracpart)
{
    *intpart = (int)x;
    *fracpart = x - *intpart;
}